<?php

include '../function.php';

// var_dump($_FILES);exit; 

$data = $_FILES['upload'];

$exts = ['jpg','gif','png','sql'];


if($data['error']!=0){
	echo "上传失败,错误代码:".$data['error'];exit;
}

$arr = explode('.', $data['name']);
$ext = end($arr);

if(!in_array($ext, $exts)){
	echo "不允许上传类型，请重新上传";exit;
}

if($data['size']>100000){
	echo "文件大小不符合";exit;
}

$name = uniqid();

move_uploaded_file($data['tmp_name'], "./Upload/".$name.".".$ext);

 ?>